/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bs.extensoesSwing;

import java.awt.Dimension;
import java.awt.FontMetrics;
import javax.swing.JButton;

/**
 *
 * @author Bone
 */
public class PadraoFormButton extends JButton{
    private FormularioController controller;

    public PadraoFormButton() {
        
    }
    

    public FormularioController getController() {
        if(controller == null)
            System.out.println("Controller em botão de formulário nulo. \nTexto do botão: " +
                    getText());
        return controller;
    }

    public void setController(FormularioController controller) {
        this.controller = controller;
    }

    @Override
    public void setText(String text) {
        super.setText(text); //To change body of generated methods, choose Tools | Templates.
        FontMetrics m = this.getFontMetrics(this.getFont());
        Dimension s = new Dimension(m.stringWidth(text), 45);
        this.setSize(s);
    }
    
}
